<?php


namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use App\Services\VideoService;
use Illuminate\Http\Request;


class VideoController extends Controller
{
    /**
     * @api {post} api/video/store 创建
     */
    public function store(Request $request, VideoService $service) {
        return $service->store($request->input(), true);
    }

    public function check(Request $request, VideoService $service) {
        return $service->check($request->input());
    }

    /**
     * @api {get} api/video/info/{id} 信息
     */
    public function show(VideoService $service, $id = null) {
        return $service->show($id);
    }

    /**
     * @api {post} api/video/update/{id} 更新
     */
    public function update(Request $request, VideoService $service, $id = null) {
        return $service->update($id, $request->input());
    }
    
    public function split(Request $request, VideoService $service, $id = null) {
        return $service->split($id, $request->input());
    }
    
    /**
     * @api {post} api/video/update/all 批量更新
     */
    public function updateAll(Request $request, VideoService $service) {
        return $service->updateAll($request->input());
    }

    /**
     * @api {post} api/video/destroy 删除
     */
    public function destroy(Request $request, VideoService $service){
        return $service->destroy($request->input('ids'));
    }

    /**
     * @api {get} api/video/lists 列表
     */
    public function lists(Request $request, VideoService $service) {
        return $service->lists($request->query());
    }
}
